package cn.wanho.redis;

import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;

@Component
public class RedisManger {
    private final static  String KEY = "exam:user:";

    @Resource
    private RedisTemplate<String,String> redisTemplate;

    public void saveJWT(Integer id,String jwt) {
        redisTemplate.opsForValue().set(KEY+id,jwt,24, TimeUnit.HOURS);
    }

    public void getJWT(Integer id) {
        redisTemplate.opsForValue().get(KEY+id);
    }
}
